package com.qingceng.coufig;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JdbcConfiguration {

    @Value("${jdbc.url}")
    String url;
    @Value("{jdbc.driverClassName}")
    String driverClassName;
    @Value("{jdbc.username}")
    String username;
    @Value("{jdbc.password}")
    String password;

    @Bean
    public DruidDataSource dataSource() {
        DruidDataSource source = new DruidDataSource();
        source.setUrl(url);
        source.setDriverClassName(driverClassName);
        source.setUsername(username);
        source.setPassword(password);
        return source;
    }

}
